/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package core;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Alexey Chirkov
 */
@ManagedBean(name = "task")
@SessionScoped
@XmlRootElement(name = "task")
public class Task implements java.io.Serializable{

    @XmlElement
    private String sourceString = "";
    @XmlElement
    private int countString;
    @XmlElement
    private String result;
    
    
    @XmlTransient
    private boolean ready = false;
    
    @EJB
    @XmlTransient
    private MyBean bean;

    /**
     * Creates a new instance of Task
     */
    public Task(){
    }

    public String getSourceString() {
        return sourceString;
    }

    public void setSourceString(String sourceString) {
        this.sourceString = sourceString;
    }

    public int getCountString() {
        return countString;
    }

    public void setCountString(int countString) {
        this.countString = countString;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getResult() {
        return result;
    }

    public boolean isReady() {
        return ready;
    }

    public void action() {
        result=bean.getResult(sourceString, countString);
        ready = true;
    }
}
